package com.zsyg.common.base;


import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.plugins.pagination.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author YangWanLi
 * @date 2018/8/12 20:56
 */
@Service
public class BaseServiceImpl<M extends BaseMapper<T>, T>  implements BaseService<T> {

    @Autowired
    protected M baseMapper;

    public BaseServiceImpl() {
    }

    /**
     * 查询
     * @param id
     * @return
     */
    @Override
    public T get(Integer id) {
        return baseMapper.get(id);
    }

    /**
     * 条件查询
     * @param t
     * @return
     */
    @Override
    public List<T> findAll(T t) {
        return baseMapper.findAll(t);
    }

    /**
     * 添加
     * @param t
     * @return
     */
    @Override
    public int insert(T t) {
        return baseMapper.insert(t);
    }

    /**
     * 修改
     * @param t
     * @return
     */
    @Override
    public int update(T t) {
        return baseMapper.update(t);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public int delete(Integer id) {
        return baseMapper.delete(id);
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @Override
    public int deleteByIds(List<Integer> ids) {
        return baseMapper.deleteByIds(ids);
    }


}
